package cn.com.api.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;













import cn.com.api.mapper.NewFindMapper;
import cn.com.api.service.INewFindService;
import cn.com.util.PageInfo;

@Service
public class NewFindServiceImpl implements INewFindService{

	private static Logger logger = Logger.getLogger(NewFindServiceImpl.class);
	@Autowired
	private NewFindMapper newFindMapper;

	@Override
	public Map<String, Object> getNewFindOrderInfo(String id, String user_id) throws Exception{
		logger.info("======NewFindServiceImpl[getNewFindOrderInfo[id:"+id+"]]===========");
	   Map<String, Object> map = new HashMap<String, Object>();	   
	   Map<String, Object> resultMap = new HashMap<String, Object>();
	   
	   map.put("id", id);

   
	   resultMap.put("orderInfoList", newFindMapper.getNewFindOrderInfo(map));
	   resultMap.put("goodsInfoList",  newFindMapper.getGoodsInfoById(id, user_id));
	   resultMap.put("userInfoList", newFindMapper.getUserInfoById(user_id));
	   resultMap.put("payInfoList", newFindMapper.getPayInfoById(id));
	   resultMap.put("distributionInfoList", newFindMapper.getDistributionInfoById(id));
	   
	   return resultMap;
	}

	@Override
	public List<Map<String, String>> selectByModListPage(
			Map<String, Object> map, PageInfo pageInfo) throws Exception{
		 logger.info("##########NewFindServiceImpl-list["+ newFindMapper.selectByModListPage(map, pageInfo)+"]#######");
		return newFindMapper.selectByModListPage(map, pageInfo);
	}

	@Override
	public boolean delete(String id) throws Exception{
				
		newFindMapper.deleteOrderDetailById(id);
		newFindMapper.deleteOrderById(id);
		return true;
	}
	


}
